import {componentsFnMap} from '../../config'
const settings = {
    "idPrefix":``,
    "labelName":"手机号",
    "componentNameShow":"手机号", // 负责显示组件的名称
    "busname":"ycPhoneline", // 唯一ID，不能重复,busname的值，关联着组件注册代码内部声明的全局校验方法，
    "componentName":'yc-phoneline', // 依据在if1.3.js中使用Vue.component注册的具体名称决定,也用作vue中v-for的key值组成
    "ycPhonelineBtnText":"发送",
    "ycPhonelineBtnFn":"",
}
componentsFnMap[settings.componentName] = {
    getHtmlStr (options = {}) {
       let {boxId, inputType="选填",componentValue = '',idPrefix = '',formName = '', formItemName = '',focusIndex = '',labelName = '标签名',labelWidth = '80px',placeholder = "不能为空"} = options
       let {minLength = '',maxLength = '',needTooltip = '0',colMd = '6',show = true,disabled} = options
       let {ycPhonelineBtnText = '',ycPhonelineBtnFn = ''} = options
       let id = `${idPrefix}`
       const {busname,componentName} = settings
       let className = `formBox fieldBox YCInputWidget if-component if-form-group ycWidget col-md-${colMd}`
       return `
                    <div id="${boxId}"
                        class="${className} ${inputType === '禁用' ? 'disabled-fieldBox': ''}"
                        focusIndex="${focusIndex}" style="display:${show?'flex':'none'};">
                        <label class="text-right" style="width:${labelWidth}">
                            ${labelName}
                            <i class="${inputType === '必填'?'required':''}"></i>
                        </label>
                        <${componentName} id="${id}_${formItemName?formItemName:'inputName'}_${focusIndex}" class="" name="${formItemName}" size="small"
                            busname="${busname}" placeholder="${placeholder}" min-length="${minLength}" max-length="${maxLength}"
                            btn-text="${ycPhonelineBtnText}" btn-fn="${ycPhonelineBtnFn}"
                            need-tooltip="${needTooltip}" :focusIndex="${focusIndex}" :value="${componentValue}" @input="${componentValue} = $event" ${inputType === '禁用' ? 'disabled': ''} ${inputType === '只读' ? 'readonly': ''}>
                        </${componentName}>
                    </div>    
       `
   }
}

export default settings